{extend name="admin/public/base"/}
{block name="body"}
<div class="box box-primary">
	<div class="box-header with-border">
		<h3 class="box-title">{$meta_title}</h3>
		<div class="box-tools pull-right">
			<a href="{:url('/admin/config/index')}" class="btn btn-sm btn-primary">
				<i class="fa fa-list"></i> 
				配置列表
			</a>
			<a href="{:url('/admin/config/add')}" class="btn btn-sm btn-danger">
				<i class="fa fa-list"></i> 
				添加配置
			</a>
		</div>
	</div>
	<div class="box-body">
		<div class="nav-tabs-custom">
			<ul class="nav nav-tabs">
				{volist name="config['config_group_list']" id="item"}
				<li {if $item.key == $id}class="active"{/if}>
					<a href="{:url('/admin/config/group',array('id'=>$item.key))}">{$item['label']}</a>
				</li>
				{/volist}
			</ul>
			<div class="tab-content">
				<div class="tab-pane tab-box fade in active" id="tab-home">
					<form method="post" class="form form-horizontal" role="form">
						{volist name="list" id="item"}
						<div class="form-group">
							<label for="inputEmail1" class="col-sm-2 control-label">{$item['title']}</label>
							<div class="col-sm-10">
								{switch name="item['type']"}
								{case value="text"}
								<input type="text" class="form-control" name="config[{$item['name']}]" id="config[{$item['name']}]" value="{$item['value']}" placeholder="{$item['title']}" style="width:50%;">
								{/case}
								{case value="num"}
								<input type="text" class="form-control" name="config[{$item['name']}]" id="config[{$item['name']}]" value="{$item['value']}" placeholder="{$item['title']}" style="width:30%;">
								{/case}
								{case value="string"}
								<input type="text" class="form-control" name="config[{$item['name']}]" id="config[{$item['name']}]" value="{$item['value']}" placeholder="{$item['title']}" style="width:80%;">
								{/case}
								{case value="textarea"}
								<textarea class="form-control" name="config[{$item['name']}]" id="config[{$item['name']}]" style="width:80%; height:120px;">{$item['value']}</textarea>
								{/case}
								{case value="select"}
								<select class="form-control selectpicker" name="config[{$item['name']}]" id="config[{$item['name']}]" style="width:auto; min-width: 150px;">
									{volist name=":parse_config_attr($item['extra'])" id="vo"}
									<option value="{$key}" {eq name="item['value']" value="$key"}selected{/eq}>{$vo}</option>
									{/volist}
								</select>
								{/case}
								{case value="bool"}
								<input id="switch_{$item['name']}" name="config[{$item['name']}]" type="hidden" value="0">
								<a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="switch_{$item['name']}" data-yes="1" data-no="0" >
									<i class="fa fa-toggle-on text-success {eq name="item['value']" value="0"}fa-flip-horizontal text-gray{/eq} fa-2x"></i>
								</a>
								{/case}
								{case value="image"}                               
                                {:widget('common/Form/showConfig',array($item,$item))}
								{/case}
								{/switch}
								{if condition="$item['remark']"}
								<span class="help-block">（{$item['remark']}）</span>
								{/if}
							</div>
						</div>
						{/volist}
						<div class="form-group">
							<div class="col-sm-offset-2 col-sm-10">
								<button type="submit" class="btn btn-success submit-btn">确认提交</button>
								<button class="btn btn-danger btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</div>

{/block}